\(\int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx\) [965]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 50 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=\frac {(A+B) \sec ^3(c+d x) (a+a \sin (c+d x))}{3 d}+\frac {a (2 A-B) \tan (c+d x)}{3 d} \]

[Out]

1/3*(A+B)*sec(d*x+c)^3*(a+a*sin(d*x+c))/d+1/3*a*(2*A-B)*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.103, Rules used = {2934, 3852, 8} \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=\frac {a (2 A-B) \tan (c+d x)}{3 d}+\frac {(A+B) \sec ^3(c+d x) (a \sin (c+d x)+a)}{3 d} \]

[In]

Int[Sec[c + d*x]^4*(a + a*Sin[c + d*x])*(A + B*Sin[c + d*x]),x]

[Out]

((A + B)*Sec[c + d*x]^3*(a + a*Sin[c + d*x]))/(3*d) + (a*(2*A - B)*Tan[c + d*x])/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2934

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.)
 + (f_.)*(x_)]), x_Symbol] :> Simp[(-(b*c + a*d))*(g*Cos[e + f*x])^(p + 1)*((a + b*Sin[e + f*x])^m/(a*f*g*(p +
 1))), x] + Dist[b*((a*d*m + b*c*(m + p + 1))/(a*g^2*(p + 1))), Int[(g*Cos[e + f*x])^(p + 2)*(a + b*Sin[e + f*
x])^(m - 1), x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && EqQ[a^2 - b^2, 0] && GtQ[m, -1] && LtQ[p, -1]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(A+B) \sec ^3(c+d x) (a+a \sin (c+d x))}{3 d}+\frac {1}{3} (a (2 A-B)) \int \sec ^2(c+d x) \, dx \\ & = \frac {(A+B) \sec ^3(c+d x) (a+a \sin (c+d x))}{3 d}-\frac {(a (2 A-B)) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d} \\ & = \frac {(A+B) \sec ^3(c+d x) (a+a \sin (c+d x))}{3 d}+\frac {a (2 A-B) \tan (c+d x)}{3 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.45 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.72 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=a \left (\frac {A \sec ^3(c+d x)}{3 d}+\frac {B \sec ^3(c+d x)}{3 d}+\frac {A \sec ^2(c+d x) \tan (c+d x)}{d}-\frac {2 A \tan ^3(c+d x)}{3 d}+\frac {B \tan ^3(c+d x)}{3 d}\right ) \]

[In]

Integrate[Sec[c + d*x]^4*(a + a*Sin[c + d*x])*(A + B*Sin[c + d*x]),x]

[Out]

a*((A*Sec[c + d*x]^3)/(3*d) + (B*Sec[c + d*x]^3)/(3*d) + (A*Sec[c + d*x]^2*Tan[c + d*x])/d - (2*A*Tan[c + d*x]
^3)/(3*d) + (B*Tan[c + d*x]^3)/(3*d))

Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.44

method result size
derivativedivides \(\frac {\frac {a A}{3 \cos \left (d x +c \right )^{3}}+\frac {B a \left (\sin ^{3}\left (d x +c \right )\right )}{3 \cos \left (d x +c \right )^{3}}-a A \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+\frac {B a}{3 \cos \left (d x +c \right )^{3}}}{d}\) \(72\)
default \(\frac {\frac {a A}{3 \cos \left (d x +c \right )^{3}}+\frac {B a \left (\sin ^{3}\left (d x +c \right )\right )}{3 \cos \left (d x +c \right )^{3}}-a A \left (-\frac {2}{3}-\frac {\left (\sec ^{2}\left (d x +c \right )\right )}{3}\right ) \tan \left (d x +c \right )+\frac {B a}{3 \cos \left (d x +c \right )^{3}}}{d}\) \(72\)
risch \(-\frac {2 i a \left (4 i A \,{\mathrm e}^{i \left (d x +c \right )}-2 i B \,{\mathrm e}^{i \left (d x +c \right )}+3 B \,{\mathrm e}^{2 i \left (d x +c \right )}+2 A -B \right )}{3 \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )^{3} d}\) \(81\)
parallelrisch \(-\frac {\left (A \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+2 \left (-A +B \right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {4 \left (2 A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{3}-\frac {A}{3}+\frac {2 B}{3}\right ) a}{d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}\) \(89\)
norman \(\frac {-\frac {2 a A +2 B a}{3 d}-\frac {2 \left (2 a A +2 B a \right ) \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (2 a A +2 B a \right ) \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {\left (4 a A +4 B a \right ) \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {2 \left (4 a A +4 B a \right ) \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {2 a A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a A \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {4 a \left (A +4 B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {8 \left (A +B \right ) a \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}-\frac {8 \left (A +B \right ) a \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(243\)

[In]

int(sec(d*x+c)^4*(a+a*sin(d*x+c))*(A+B*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/3*a*A/cos(d*x+c)^3+1/3*B*a*sin(d*x+c)^3/cos(d*x+c)^3-a*A*(-2/3-1/3*sec(d*x+c)^2)*tan(d*x+c)+1/3*B*a/cos
(d*x+c)^3)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.38 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=-\frac {{\left (2 \, A - B\right )} a \cos \left (d x + c\right )^{2} + {\left (2 \, A - B\right )} a \sin \left (d x + c\right ) - {\left (A - 2 \, B\right )} a}{3 \, {\left (d \cos \left (d x + c\right ) \sin \left (d x + c\right ) - d \cos \left (d x + c\right )\right )}} \]

[In]

integrate(sec(d*x+c)^4*(a+a*sin(d*x+c))*(A+B*sin(d*x+c)),x, algorithm="fricas")

[Out]

-1/3*((2*A - B)*a*cos(d*x + c)^2 + (2*A - B)*a*sin(d*x + c) - (A - 2*B)*a)/(d*cos(d*x + c)*sin(d*x + c) - d*co
s(d*x + c))

Sympy [F]

\[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=a \left (\int A \sec ^{4}{\left (c + d x \right )}\, dx + \int A \sin {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}\, dx + \int B \sin {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}\, dx + \int B \sin ^{2}{\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}\, dx\right ) \]

[In]

integrate(sec(d*x+c)**4*(a+a*sin(d*x+c))*(A+B*sin(d*x+c)),x)

[Out]

a*(Integral(A*sec(c + d*x)**4, x) + Integral(A*sin(c + d*x)*sec(c + d*x)**4, x) + Integral(B*sin(c + d*x)*sec(
c + d*x)**4, x) + Integral(B*sin(c + d*x)**2*sec(c + d*x)**4, x))

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.18 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=\frac {B a \tan \left (d x + c\right )^{3} + {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} A a + \frac {A a}{\cos \left (d x + c\right )^{3}} + \frac {B a}{\cos \left (d x + c\right )^{3}}}{3 \, d} \]

[In]

integrate(sec(d*x+c)^4*(a+a*sin(d*x+c))*(A+B*sin(d*x+c)),x, algorithm="maxima")

[Out]

1/3*(B*a*tan(d*x + c)^3 + (tan(d*x + c)^3 + 3*tan(d*x + c))*A*a + A*a/cos(d*x + c)^3 + B*a/cos(d*x + c)^3)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (46) = 92\).

Time = 0.31 (sec) , antiderivative size = 94, normalized size of antiderivative = 1.88 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=-\frac {\frac {3 \, {\left (A a - B a\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1} + \frac {9 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, B a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 \, A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 7 \, A a + B a}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}^{3}}}{6 \, d} \]

[In]

integrate(sec(d*x+c)^4*(a+a*sin(d*x+c))*(A+B*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/6*(3*(A*a - B*a)/(tan(1/2*d*x + 1/2*c) + 1) + (9*A*a*tan(1/2*d*x + 1/2*c)^2 + 3*B*a*tan(1/2*d*x + 1/2*c)^2
- 12*A*a*tan(1/2*d*x + 1/2*c) + 7*A*a + B*a)/(tan(1/2*d*x + 1/2*c) - 1)^3)/d

Mupad [B] (verification not implemented)

Time = 11.29 (sec) , antiderivative size = 107, normalized size of antiderivative = 2.14 \[ \int \sec ^4(c+d x) (a+a \sin (c+d x)) (A+B \sin (c+d x)) \, dx=\frac {\frac {2\,a\,\left (\frac {3\,B}{2}+A\,\cos \left (c+d\,x\right )+B\,\cos \left (c+d\,x\right )+2\,A\,\sin \left (c+d\,x\right )-B\,\sin \left (c+d\,x\right )+A\,\cos \left (2\,c+2\,d\,x\right )-\frac {B\,\cos \left (2\,c+2\,d\,x\right )}{2}\right )}{3}-\frac {4\,a\,\cos \left (c+d\,x\right )\,\left (\frac {A}{2}+\frac {B}{2}\right )}{3}}{d\,\left (2\,\cos \left (c+d\,x\right )-\sin \left (2\,c+2\,d\,x\right )\right )} \]

[In]

int(((A + B*sin(c + d*x))*(a + a*sin(c + d*x)))/cos(c + d*x)^4,x)

[Out]

((2*a*((3*B)/2 + A*cos(c + d*x) + B*cos(c + d*x) + 2*A*sin(c + d*x) - B*sin(c + d*x) + A*cos(2*c + 2*d*x) - (B
*cos(2*c + 2*d*x))/2))/3 - (4*a*cos(c + d*x)*(A/2 + B/2))/3)/(d*(2*cos(c + d*x) - sin(2*c + 2*d*x)))